const fs = require('fs');
const util = require('util')
//原生fs
// fs.readFile('../resources/1.txt',(err,data1) => {
//     if (err) throw err;
//     fs.readFile('../resources/2',(err,data2) => {
//         if (err) throw err;
//         fs.readFile('../resources/2',(err,data3) => {
//             if (err) throw err;
//             console.log(data1 + data2 +data3);
//         })
//     })
// })

//用async 和 await
const mineReadFile = util.promisify(fs.readFile);

async function main() {
    let data1 = await mineReadFile('../resources/1.txt');
    let data2 = await mineReadFile('../resources/2');
    let data3 = await mineReadFile('../resources/3.txt');
    console.log(data1 + data2 +data3);
}
main()
